<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

  <div id="app" align="center">
    <h2>{{message}}</h2>

    <div>
      <parent></parent>
    </div>
  </div>

<!-- 开发环境版本，包含了有帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<script>

  //子组件构造器
  const sonCpnC = Vue.extend({
    template: `
    <div>
    <h2>子组件</h2>
    <p>子组件内容</p>
</div>
    `
  });

  //父组件构造器
  /*父组件中定义了子组件*/
  const parentCpnC = Vue.extend({
    template: `
    <div>
    <h2>父组件</h2>
    <p>父组件内容</p>
    <son></son>
</div>
    `,
    components: {
      son: sonCpnC,
    }
  });

  const app = new Vue({
    el: "#app",
    data: {
      message: "Hello Vue !"
    },
    components:{
      parent: parentCpnC
    },
    methods: {

    }
  })

</script>



</body>
</html>